package com.lanou.elh.sysmanage.system_order.service.impl;

import com.lanou.elh.sysmanage.system_order.entity.Order;
import com.lanou.elh.sysmanage.system_order.mapper.OrderMapper;
import com.lanou.elh.sysmanage.system_order.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class OrderServiceImpl implements OrderService {
    @Autowired
    private OrderMapper orderMapper;

    @Override
    public Integer orderCount() {
        return orderMapper.orderCont();
    }

    @Override
    public void orderCancelById(Order order) {
        order.setClose_time(new Date());
        order.setUpdate_time(new Date());
        order.setStatus(5);
        orderMapper.orderCancelById(order);
    }

    @Override
    public void orderDel(String id) {
        orderMapper.orderDelById(id);
    }

    @Override
    public List<Order> orderSelectById(String id) {
        List<Order> order = orderMapper.SelectById(id);
//        System.out.println("service层"+order);
        return order;
    }

    @Override
    public Integer remark(Order order) {
        orderMapper.remarkMessageById(order);
        return 1;
    }

    @Override
    public Integer deliver(Order order) {
        order.setConsign_time(new Date());
        order.setUpdate_time(new Date());
        order.setStatus(3);
        orderMapper.deliverById(order);
        return 1;
    }

    @Override
    public List<Order> selectAll() {
        List<Order> list = orderMapper.selectAll();
        return list;
    }
}
